{extend name="common/base"}
{block name="data_type"}widgets{/block}

            {block name="content"}
<style>
    .son1 {margin-left: 10px;}
    .son2 {margin-left: 20px;}
</style>
            <div class="row-content am-cf">


                <div class="row">

                    <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                        <div class="widget am-cf">
                            <div class="widget-head am-cf">
                                <div class="widget-title am-fl">角色权限管理</div>
                                <div class="widget-function am-fr">
                                    <a href="javascript:;" class="am-icon-cog"></a>
                                </div>
                            </div>
                            <div class="widget-body am-fr">

                                <form class="am-form tpl-form-line-form" action="{:url('rolepermissionstore')}" method="post" enctype="multipart/form-data">


                                    <div class="am-form-group">
                                        <label for="url" class="am-u-sm-3 am-form-label">角色名称 </label>
                                        <div class="am-u-sm-9">
                                            <input type="text" class="am-form-field tpl-form-no-bg" name="name" id="name" value="{$role.rolename}">
                                            <input type="hidden" name="role_id" value="{$Think.get.id}">
                                        </div>
                                    </div>

                                    <div class="am-form-group">
                                        {foreach name="permission" id="v1" key="k1"}
                                        <div class="row">
                                            <input type="checkbox" name="permission_id[]" value="{$v1.id}" {if condition="in_array($v1.id , $having_permissions_id)"}checked{/if} id="permission-{$v1.id}"> <label
                                                for="permission-{$v1.id}">{$v1.personal_name}</label>
                                            {if condition="isset($v1['son'])"}
                                            <div class="row son1">
                                                {foreach name="v1['son']" id="v2" key="k2"}
                                                <input type="checkbox" name="permission_id[]" value="{$v2.id}" {if condition="in_array($v2.id , $having_permissions_id)"}checked{/if} id="permission-{$v2.id}"> <label
                                                    for="permission-{$v2.id}">{$v2.personal_name}</label>
                                                {if condition="isset($v2['son'])"}

                                                <div class="row son2">
                                                    {foreach name="v2['son']" id="v3" key="k3"}
                                                    <input type="checkbox" name="permission_id[]" value="{$v3.id}" {if condition="in_array($v3.id , $having_permissions_id)"}checked{/if} id="permission-{$v3.id}">
                                                    <label for="permission-{$v3.id}">{$v3.personal_name}</label>
                                                    {/foreach}
                                                </div>

                                                {/if}
                                                {/foreach}
                                            </div>
                                            {/if}
                                        </div>
                                        {/foreach}
                                    </div>

                                    <div class="am-form-group">
                                        <div class="am-u-sm-9 am-u-sm-push-3">
                                            <button type="submit" class="am-btn am-btn-primary tpl-btn-bg-color-success ">提交</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>



            </div>
            {/block}